package com.culturalCenter.dataCenter.controller;

import com.culturalCenter.dataCenter.Utils.ApiResult;
import com.culturalCenter.dataCenter.Utils.Message;
import com.culturalCenter.dataCenter.Utils.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.culturalCenter.dataCenter.Utils.ApiResult.instance;

@RestController
@RequestMapping("/v1/sms")
@Api(tags = "短信模块")
public class SMSController {

    @GetMapping("/sendMsg")
    @ApiOperation(value = "发送短信")
    public ApiResult sendMsg(String phone){
        Message msg = new Message();
        try {
            msg.send(null,phone);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return instance(ResultCode.SUCCESS, phone+"短信发送成功");
    }
}
